using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Decisions.HL7.Message;
using DecisionsFramework;

namespace Decisions.HL7.Message
{
    public class ContainerConditionAttribute:RuleAttribute
    {
        private Dictionary<HL7Version, string[]> validVersionCodes = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, string[]> validVersionDescriptions = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, HL7TableType> tableVersionTypes = new Dictionary<HL7Version, HL7TableType>();

        public ContainerConditionAttribute()
        {
            // init the values for table version types
						tableVersionTypes[HL7Version.v25] = HL7TableType.User;
						tableVersionTypes[HL7Version.v251] = HL7TableType.User;
						tableVersionTypes[HL7Version.v26] = HL7TableType.User;
						tableVersionTypes[HL7Version.v27] = HL7TableType.User;
			
            
			// init the values for version codes
						validVersionCodes[HL7Version.v25] = new string[]{""};
						validVersionCodes[HL7Version.v251] = new string[]{"..."};
						validVersionCodes[HL7Version.v26] = new string[]{"..."};
						validVersionCodes[HL7Version.v27] = new string[]{"XC37","XAMB","XCAMB","XREF","XCREF","XFRZ","XCFRZ","XDFRZ","XUFRZ","XNTR","XPRTL","XCATM","XDRY","XPSO","XPSA","XUPR","XMTLF","SB","CC","CT","CL"};
			
			// init the values for version descriptions
						validVersionDescriptions[HL7Version.v25] = new string[]{""};
						validVersionDescriptions[HL7Version.v251] = new string[]{"No suggested values"};
						validVersionDescriptions[HL7Version.v26] = new string[]{"No suggested values"};
						validVersionDescriptions[HL7Version.v27] = new string[]{"Not Body temperature","Not Ambient temperature","Not Critical ambient temperature","Not Refrigerated temperature","Not Critical refrigerated temperature","Not Frozen temperature","Not Critical frozen temperature","Not Deep frozen","Not Ultra frozen","Not Liquid nitrogen","Not Protected from light","Exposed to Air","Not Dry","Exposed to shock","Shaken","Not Upright","Metal Exposed","Seal Broken","Container Cracked","Container Torn","Container Leaking"};
			            

        }

        
        public override ValidationIssue[] RunRule(string name, object owningObject, object value)
        {
            //todo: check if the value is valid in the current version
            //if the value is not valid in the current version, add it as a validation issue


            return new ValidationIssue[0];
        }
    }
}
